BIN=test_makefile.exe
CC=gcc
# SRC=$(shell ls *.c)
SRC=$(wildcard *.c)
OBJ=$(SRC:.c=.o)
LFLAGS=-o
FLAGS=-c
RM=rm -f

$(BIN):$(OBJ)
	@$(CC) $(LFLAGS) $@ $^
	@echo "linking ...$^ to $@"

%.o:%.c
	@$(CC) $(FLAGS) $<
	@echo "compling...$< to $@"

.PHONY:clean
clean:
	@$(RM) $(OBJ) $(BIN)
	@echo "delete the .o and bin test_makefile..."

.PHONY:test 
test:
	@echo $(SRC)
	@echo $(OBJ)
	@echo $(SRC)
	@echo $(BIN)
	@echo "print all variable..."

# BIN=test_makefile.exe
# CC=gcc
# SRC=test_makefile.c
# FLAGS=-o
# RM=rm -f
# 
# $(BIN):$(SRC)
# 	@$(CC) $(FLAGS) $@ $^
# 	@echo "linking... $^ to $@"
# 
# .PHONY:
# clean:
# 	@$(RM) $(BIN)
# 	@echo "remove...$(BIN)"
# 
# .PHONY:test 
# test:
# 	@echo $(BIN)
# 	@echo $(CC)
# 	@echo $(SRC)
# 	@echo $(FLAGS)
# 	@echo $(RM)
# 	

# test_makefile:test_makefile.c
# 	gcc -o test_makefile test_makefile.c
# 
# .PHONY:clean
# clean:
# 	rm -f test_makefile

# 
# test_makefile:test_makefile.o
# 	gcc test_makefile.o -o test_makefile
# test_makefile.o:test_makefile.s
# 	gcc -c test_makefile.s -o test_makefile.o
# test_makefile.s:test_makefile.i
# 	gcc -S test_makefile.i -o test_makefile.s
# test_makefile.i:test_makefile.c
# 	gcc -E test_makefile.c -o test_makefile.i
# 
# .PHONY:
# clean:
# 	rm -f *.i *.s *.o test_makefile 
# 
